import pandas

# 1.创建 Series 的三种方式
# (1) 字典类型生成
# dic = {'sex': '男', 'age': 25, 'score': 100}
# series = pandas.Series(dic)
# print(series)
#
# (2) 列表类型
# vlist = ['好', 'name', 1,2,3]
# series = pandas.Series(vlist)
# print(series)


# vlist = ['好', 'name', 1, 2, 3]
# series = pandas.Series(vlist, index=['a1', 'b2', 'c3', 'd4', 'e5'])
# print(series)

# (3) Numpy 数组生成
# import pandas
# import numpy
#
# varray = numpy.random.randint(1, 10, size=10)
# series = pandas.Series(varray)
# print(series)

# 2. Series对象的索引操作和切片操作
# (1)
# dic = {'sex': '男', 'age': 25, 'score': 100}
# series = pandas.Series(dic)
# print(series.iloc[0])
# print(series['age'])
# (2)
dic = {'sex': '男', 'age': 25, 'score': 100}
series = pandas.Series(dic)
v1 = series.iloc[0:2]
v2 = series['sex': 'score']
print(v1, '\n', v2)
